import Vue from "vue";

import "normalize.css/normalize.css"; // A modern alternative to CSS resets

// import Cookies from 'js-cookie'
import i18n from "./lang";

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import "@/styles/index.scss"; // global css

import App from "./App";
import store from "./store";
import router from "./router";

import "@/icons"; // icon
import "@/permission"; // permission control

import { Loading, MessageBox, Message, Notification } from "element-ui";

import VueAMap from "vue-amap";
import echarts from 'echarts'

import dataV from '@jiaminghi/data-view'
import moment from 'moment'

import preventReClick from './utils/preventRepeatClick.js'

import TencentMap from 'vue-tencent-map'


Vue.prototype.$moment = moment;



// 引入腾讯地图路线规划
import { cb } from './utils/cb';
window.cb = cb
import { display_polyline } from './utils/cb';
window.display_polyline = display_polyline


Vue.use(dataV);
Vue.prototype.$echarts = echarts
Vue.use(TencentMap, {
  key: 'UCBBZ-NX5KW-BJKRE-3XEJG-CJLE3-X3B2R'
})

Vue.use(VueAMap);
VueAMap.initAMapApiLoader({
  key: "51d7b88237507c89371c1d3424afa4ca",
  plugin: [
    "Geocoder",
    "AMap.Autocomplete",
    "AMap.PlaceSearch",
    "AMap.Scale",
    "AMap.OverView",
    "AMap.ToolBar",
    "AMap.MapType",
    "AMap.PolyEditor",
    "AMap.CircleEditor"
  ],
  // 默认高德 sdk 版本为 1.4.4
  v: "1.4.4"
});

Vue.prototype.$loading = Loading.service;
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$notify = Notification;
Vue.prototype.$message = Message;
// Vue.prototype.$store2 = store;
// Vue.prototype.$router2 = router;



import VCalendar from "v-calendar";
Vue.use(VCalendar);

import weixinPlugin from "@/utils/weixin-plugin";
Vue.use(weixinPlugin);

import JsonExcel from "vue-json-excel";
Vue.component("downloadExcel", JsonExcel);

Vue.use(preventReClick);
// <el-button type="primary" @click="onSubmit" v-preventReClick>查询</el-button>

// import vConsole from "vconsole";
// new vConsole();

// import { Settings } from 'luxon'

// Settings.defaultLocale = 'zh'

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
// if (process.env.NODE_ENV === 'production') {
//   const { mockXHR } = require('../mock')
//   mockXHR()
// }

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI);

Vue.config.productionTip = false;

// const setHtmlFontSize = () => {
//   const htmlDom = document.getElementsByTagName('html')[0];
//   let htmlWidth = document.documentElement.clientWidth || document.body.clientWidth;
//   if (htmlWidth >= 750) {
//     htmlWidth = 750;
//   }
//   if (htmlWidth <= 320) {
//     htmlWidth = 320;
//   }
//   htmlDom.style.fontSize = `${htmlWidth / 7.5}px`;
// };
// window.onresize = setHtmlFontSize;
// setHtmlFontSize();


new Vue({
  el: "#app",
  router,
  i18n,
  store,
  render: h => h(App)
});
